package com.mentaleye.biz.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mentaleye.bean.PermissionsRoleKeyBean;
import com.mentaleye.biz.PermissionsRoleBiz;
import com.mentaleye.service.PermissionsRoleService;

@Service
public class PermissionsRoleBizImpl implements PermissionsRoleBiz{
	
	private static Logger logger = Logger.getLogger(PermissionsRoleBizImpl.class);
	
	@Autowired private PermissionsRoleService permissionsRoleService;
	@Override
	public boolean addPermissiosRoleBean(PermissionsRoleKeyBean permissionBean) {
		try {
			return permissionsRoleService.addPermissionsRole(permissionBean);
		} catch (Exception e) {
			logger.error("添加角色权限异常",e);
		}
		return false;
	}

	@Override
	public List<PermissionsRoleKeyBean> queryPermissionsRole(Integer roleId) {
		try {
			return permissionsRoleService.queryPermissionsRole(roleId);
		} catch (Exception e) {
			logger.error("查询角色权限异常",e);
		}
		return null;
	}
	

	

	@Override
	public boolean updatePermissionsRole(PermissionsRoleKeyBean permissionsRoleBean) {
		try {
			if(permissionsRoleBean != null){
				return permissionsRoleService.updatePermissionsRole(permissionsRoleBean);
			}
		} catch (Exception e) {
			logger.error("修改角色权限异常",e);
		}
		return false;
	}

	@Override
	public boolean addPermissiosRoleBeanList(List<PermissionsRoleKeyBean> beanlist) {
		try {
			return permissionsRoleService.addPermissionsRoleList(beanlist);
		} catch (Exception e) {
			logger.error("添加角色权限异常",e);
		}
		return false;
	}

	@Override
	public boolean deletePermissionsRole(Integer roleNo) {
		try {
			return permissionsRoleService.deletePermissionsRole(roleNo);
		} catch (Exception e) {
			logger.error("删除角色权限异常",e);
		}
		return false;
	}
	
	

}
